#!/usr/bin/env python
#-*- coding:utf-8 -*-

import ConfigParser    
import logging

def bmc_ctrl_load_cfg():
	#加载配置项
	global BMC_LOGGER

	cfgfile='mds.cfg'
	conf = ConfigParser.ConfigParser()
	conf.read(cfgfile)

	BMC_LOGGER = logging.getLogger(__name__)
	#BMC_LOG.setLevel(BMC_LOG_LEVEL)
	fh = logging.FileHandler(conf.get("BMC","log_file"),'a')
	fh.setLevel(conf.getint("BMC","log_level"))
	fh.setFormatter(logging.Formatter("%(asctime)s - %(filename)s[line:%(lineno)d] - %(levelname)s: %(message)s"))
	BMC_LOGGER.addHandler(fh)

def logger_test():
	bmc_ctrl_load_cfg()
	BMC_LOGGER.debug('debug msg')
	BMC_LOGGER.info('info msg')
	BMC_LOGGER.warning('warning msg')
	BMC_LOGGER.error('error msg')
	BMC_LOGGER.critical('critical msg')

if __name__ == '__main__':
	str_v_p="ab"	
	print(_bmc_check_file_path(str_v_p))
	print(_bmc_check_file_path(str_v_p,True))
